#ifndef __BITFILE_H__
#define __BITFILE_H__

typedef unsigned char BYTE;

typedef struct _bit_file {
	BYTE * bytes;	// read all into memory
	int len;	// len in bytes
	int off;	// offset in bytes
} bit_file;

void bit_file_init(bit_file * bf, FILE * fp);
void bit_file_free(bit_file * bf);

int bit_file_peek_bits(bit_file * bf, int bits);
int bit_file_read(bit_file * bf, int bytes, void *out);

#endif // __BITFILE_H__

